package com.my.swas.sso.module.admin.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.my.swas.common.constans.CommConst;
import com.my.swas.sso.module.admin.entity.Role;
import lombok.Data;


import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description:
 * @author: :MaYong
 */
@Data
public class UserVo {
    private Long id;
    private String userAccount;
    @JsonIgnore
    private String password;
    private Integer enable;
    private Integer verifyCount;
    private String roleTips;
    private String email;
    private String phone;
    private String avatar;
    private Integer sex;
    private String realName;
    private String nickName;
    private List<Role> roleList = Lists.newArrayList();
    public String getRoleTips() {
        return Joiner.on(CommConst.COMMA).join(roleList.stream()
                .map(Role :: getRoleTips)
                .collect(Collectors.toSet()));
    }

}
